Being able to get information about each backup, time required, storage used, is important. My need to script something to get summary data about the backup. I like to get a daily report that spells out how long and how much, since it will be the first thing I see to know if something failed or if a system has been compromised with lots of changed files. aka crypto-ware.
Code:
$ sudo rdiff-backup --list-increment-sizes /d/D7/backups/nextcloud
Time Size Cumulative size
-----------------------------------------------------------------------------
Wed Feb 1 00:09:55 2023 7.80 GB 7.80 GB (current mirror)
Tue Jan 31 00:14:10 2023 44.6 MB 7.84 GB
Mon Jan 30 00:12:39 2023 38.3 MB 7.88 GB
Sun Jan 29 00:07:00 2023 118 MB 7.99 GB
...
Sun Nov 6 00:06:40 2022 139 MB 13.7 GB
Sat Nov 5 00:05:48 2022 63.0 MB 13.8 GB
Fri Nov 4 00:05:42 2022 63.9 MB 13.8 GB
The output below comes from rdiff-backup files: Code:
#!/bin/bash
SRVS="blog44 nextcloud pi3"
SOURCE_DIR="/d/D7/backups"
TODAY=$(/usr/bin/date "+%F")
for D in $SRVS ; do
/usr/bin/egrep 'TotalDestinationSizeChange|StartTime|EndTime|ElapsedTime' \
$SOURCE_DIR/$D/rdiff-backup-data/session_statistics.$TODAY*.data
done
Example reports:
=== Time for Backups to blog44 ===
StartTime 1675228169.00 (Wed Feb 1 00:09:29 2023)
EndTime 1675228191.72 (Wed Feb 1 00:09:51 2023)
ElapsedTime 22.72 (22.72 seconds)
TotalDestinationSizeChange 965033 (942 KB)
=== Time for Backups to nextcloud ===
StartTime 1675228195.00 (Wed Feb 1 00:09:55 2023)
EndTime 1675228263.15 (Wed Feb 1 00:11:03 2023)
ElapsedTime 68.15 (1 minute 8.15 seconds)
TotalDestinationSizeChange 78170155 (74.5 MB)
=== Time for Backups to pi3 ===
StartTime 1675228276.00 (Wed Feb 1 00:11:16 2023)
EndTime 1675228285.43 (Wed Feb 1 00:11:25 2023)
ElapsedTime 9.43 (9.43 seconds)
TotalDestinationSizeChange 636029 (621 KB)
Last Update: 2023-02-09